<script setup lang="ts">
// import { useI18n } from 'vue-i18n';
import * as Antd from 'ant-design-vue';
import useLocale from '@/lang/useLocale'
// const { t,locale } = useI18n();


const {
  i18n,
  t,
  currentLocale, //当前国际化
  changeLocale, // 修改国际化
} = useLocale()

// 切换语言
const switchLang = () => {
  if (currentLocale.value == 'zh') {
    changeLocale('en')
  } else {
    changeLocale('zh')
  }
}



</script>

<template>
  <div>
    <h1>国际化</h1>
    <Antd.Button type="primary" @click="switchLang">change {{t('langName')}}</Antd.Button>

    {{t('langName')}}|{{t('common.save.success')}}
    
  
  </div>
</template>

<style scoped>

</style>
